<template>
  <div>
    <el-dialog :visible.sync="visible" v-bind="$attrs" v-on="$listeners" @open="onOpen" @close="onClose" title="Dialog Titile">
      <el-row :gutter="15">
        <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"
                 label-position="left">
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单选框组" prop="field105">
                  <el-radio-group v-model="formData.field105" size="medium">
                    <el-radio v-for="(item, index) in field105Options" :key="index" :label="item.value"
                              :disabled="item.disabled">{{item.label}}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单选框组" prop="field106">
                  <el-radio-group v-model="formData.field106" size="medium">
                    <el-radio v-for="(item, index) in field106Options" :key="index" :label="item.value"
                              :disabled="item.disabled">{{item.label}}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单选框组" prop="field112">
                  <el-radio-group v-model="formData.field112" size="medium">
                    <el-radio v-for="(item, index) in field112Options" :key="index" :label="item.value"
                              :disabled="item.disabled">{{item.label}}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="计数器" prop="field113">
                  <el-input-number v-model="formData.field113" placeholder="计数器" :step='1' :precision='2'>
                  </el-input-number>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="计数器" prop="field114">
                  <el-input-number v-model="formData.field114" placeholder="计数器" :step='1'></el-input-number>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="计数器" prop="field115">
                  <el-input-number v-model="formData.field115" placeholder="计数器" :step='1'></el-input-number>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="日期选择" prop="field123">
                  <el-date-picker v-model="formData.field123" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                  :style="{width: '100%'}" placeholder="请选择日期选择" clearable></el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="日期选择" prop="field126">
                  <el-date-picker v-model="formData.field126" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                  :style="{width: '100%'}" placeholder="请选择日期选择" clearable></el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单选框组" prop="field124">
                  <el-radio-group v-model="formData.field124" size="medium">
                    <el-radio v-for="(item, index) in field124Options" :key="index" :label="item.value"
                              :disabled="item.disabled">{{item.label}}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单行文本" prop="field125">
                  <el-input v-model="formData.field125" placeholder="请输入单行文本" clearable
                            :style="{width: '100%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单行文本" prop="field127">
                  <el-input v-model="formData.field127" placeholder="请输入单行文本" clearable
                            :style="{width: '100%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单行文本" prop="field132">
                  <el-input v-model="formData.field132" placeholder="请输入单行文本" clearable
                            :style="{width: '100%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row>
              <el-col :span="12">
                <el-form-item label="单行文本" prop="field128">
                  <el-input v-model="formData.field128" placeholder="请输入单行文本" clearable
                            :style="{width: '100%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="24">
            <el-row>
              <el-col :span="24">
                <el-form-item label="多行文本" prop="field133">
                  <el-input v-model="formData.field133" type="textarea" placeholder="请输入多行文本"
                            :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-form>
      </el-row>
      <div slot="footer">
        <el-button @click="close">取消</el-button>
        <el-button type="primary" @click="handelConfirm">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
  export default {
    name: 'updateSaleInfo',
    inheritAttrs: false,
    components: {},
    props: [],
    data () {
      return {
        visible: false,
        formData: {
          field105: undefined,
          field106: undefined,
          field112: undefined,
          field113: undefined,
          field114: undefined,
          field115: undefined,
          field123: null,
          field126: null,
          field124: undefined,
          field125: undefined,
          field127: undefined,
          field132: undefined,
          field128: undefined,
          field133: undefined
        },
        rules: {
          field105: [{
            required: true,
            message: '单选框组不能为空',
            trigger: 'change'
          }],
          field106: [{
            required: true,
            message: '单选框组不能为空',
            trigger: 'change'
          }],
          field112: [{
            required: true,
            message: '单选框组不能为空',
            trigger: 'change'
          }],
          field113: [{
            required: true,
            message: '计数器',
            trigger: 'blur'
          }],
          field114: [{
            required: true,
            message: '计数器',
            trigger: 'blur'
          }],
          field115: [{
            required: true,
            message: '计数器',
            trigger: 'blur'
          }],
          field123: [{
            required: true,
            message: '请选择日期选择',
            trigger: 'change'
          }],
          field126: [{
            required: true,
            message: '请选择日期选择',
            trigger: 'change'
          }],
          field124: [{
            required: true,
            message: '单选框组不能为空',
            trigger: 'change'
          }],
          field125: [{
            required: true,
            message: '请输入单行文本',
            trigger: 'blur'
          }],
          field127: [{
            required: true,
            message: '请输入单行文本',
            trigger: 'blur'
          }],
          field132: [{
            required: true,
            message: '请输入单行文本',
            trigger: 'blur'
          }],
          field128: [{
            required: true,
            message: '请输入单行文本',
            trigger: 'blur'
          }],
          field133: [{
            required: true,
            message: '请输入多行文本',
            trigger: 'blur'
          }]
        },
        field105Options: [{
          'label': '选项一',
          'value': 1
        }, {
          'label': '选项二',
          'value': 2
        }],
        field106Options: [{
          'label': '选项一',
          'value': 1
        }, {
          'label': '选项二',
          'value': 2
        }],
        field112Options: [{
          'label': '选项一',
          'value': 1
        }],
        field124Options: [{
          'label': '选项一',
          'value': 1
        }, {
          'label': '选项二',
          'value': 2
        }]
      }
    },
    computed: {},
    watch: {},
    created () {},
    mounted () {},
    activated () {
      this.init()
    },
    methods: {
      init () {
        this.visible = true
        this.$nextTick(() => {
        })
      },
      onOpen () {},
      onClose () {
        this.$refs['elForm'].resetFields()
      },
      close () {
        this.$emit('update:visible', false)
      },
      handelConfirm () {
        this.$refs['elForm'].validate(valid => {
          if (!valid) return
          this.close()
        })
      }
    }
  }
</script>
<style>
</style>
